package com.blog.sys.dto;

import com.blog.sys.entity.SysRole;
import com.blog.sys.entity.SysUser;

import java.util.ArrayList;
import java.util.List;

public class SysUserDto extends SysUser {

    private String roleStr;

    public String getRoleStr() {
        return roleStr;
    }


    public void setRoleStr(String roleStr) {
        String[] split = roleStr.split(",");
        List<SysRole> roles = new ArrayList<>();
        for (String s:
             split) {
            SysRole sysRole = new SysRole();
            sysRole.setId(Integer.valueOf(s));
            roles.add(sysRole);
        }
        super.setRoleList(roles);
    }
}
